package Set.TreeSet;

import java.util.Iterator;
import java.util.TreeSet;
import java.util.function.Consumer;

public class Test1 {
    public static void main(String[] args) {
        TreeSet<Integer> ts = new TreeSet<>();
        ts.add(1);
        ts.add(2);
        ts.add(6);
        ts.add(4);

        for (Integer t : ts) {
            System.out.println(t);
        }

        Iterator<Integer> it = ts.iterator();
        while(it.hasNext()){
            Integer i = it.next();
            System.out.println(i);
        }

        ts.forEach(i->
                System.out.println(i)

        );
    }
}
